import React,{useState,useEffect} from 'react'
import Title from './Component/neirong_title'
import Flushed from '../../Monitoring_analytics/Operate_monitor/Component/Flushed'
import Content from './Component/neirong_table'

import {getworks} from '../../../request/api'
export default function Searchci() {

  useEffect(() => {
    Getuserlabel()
  }, [])
  const [usedata, setusedata] = useState<any>([])
  const Getuserlabel = async () => {
    const res = await getworks({})
    if (res.code == 200) {
      setusedata(res.data)
    }
  }
  // 获取子组件传递的搜索完后的数据信息，更新用户信息
  const getTitle = (item: any) => {
    console.log(item);
    setusedata(item)
  }
  // 添加用户标签之后获取最新的用户数据
  const getuserlist = (item: any) => {
    if (item == 200) {
      Getuserlabel()
    }
  }

  return (
    <div>
      <Title getTitle={getTitle} getuserlist={getuserlist}></Title>
      <Flushed></Flushed>
      <div style={{ width: '100%', backgroundColor: 'white', padding: '0.5rem', marginTop: '0.5rem' }}>
        <Content userdata={usedata} getTitle={getTitle} getuserlist={getuserlist}></Content>
      </div>
    </div>
  )
}
